Left Termination of the query pattern mergesort_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof

Clauses:

mergesort([], []).
mergesort(.(X, []), .(X, [])).
mergesort(.(X, .(Y, Xs)), Ys) :- ','(split(.(X, .(Y, Xs)), X1s, X2s), ','(mergesort(X1s, Y1s), ','(mergesort(X2s, Y2s), merge(Y1s, Y2s, Ys)))).
split([], [], []).
split(.(X, Xs), .(X, Ys), Zs) :- split(Xs, Zs, Ys).
merge([], Xs, Xs).
merge(Xs, [], Xs).
merge(.(X, Xs), .(Y, Ys), .(X, Zs)) :- ','(le(X, Y), merge(Xs, .(Y, Ys), Zs)).
merge(.(X, Xs), .(Y, Ys), .(Y, Zs)) :- ','(gt(X, Y), merge(.(X, Xs), Ys, Zs)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).

Queries:

mergesort(g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof
  ↳ PrologToPiTRSProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
MERGESORT_IN(.(X, .(Y, Xs)), Ys) → SPLIT_IN(.(X, .(Y, Xs)), X1s, X2s)
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → U51(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U31(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U41(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → MERGE_IN(Y1s, Y2s, Ys)
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U101(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U91(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U111(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U71(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U111(x1, x2, x3)  =  U111(x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x5, x6)
U71(x1, x2, x3, x4, x5, x6)  =  U71(x1, x6)
U51(x1, x2, x3, x4, x5)  =  U51(x1, x5)
U101(x1, x2, x3)  =  U101(x3)
U41(x1, x2, x3, x4, x5)  =  U41(x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x3, x6)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
MERGESORT_IN(.(X, .(Y, Xs)), Ys) → SPLIT_IN(.(X, .(Y, Xs)), X1s, X2s)
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → U51(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U31(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U41(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → MERGE_IN(Y1s, Y2s, Ys)
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U101(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U91(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U111(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U71(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U111(x1, x2, x3)  =  U111(x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x5, x6)
U71(x1, x2, x3, x4, x5, x6)  =  U71(x1, x6)
U51(x1, x2, x3, x4, x5)  =  U51(x1, x5)
U101(x1, x2, x3)  =  U101(x3)
U41(x1, x2, x3, x4, x5)  =  U41(x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x3, x6)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 5 SCCs with 11 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
LE_IN(x1, x2)  =  LE_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
GT_IN(x1, x2)  =  GT_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U61(X, Xs, Y, Ys, le_out) → MERGE_IN(Xs, .(Y, Ys))
U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U61(X, Xs, Y, Ys, le_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U10(gt_out) → gt_out
U11(le_out) → le_out

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
U10(x0)
U11(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MERGE_IN(.(X, Xs), .(Y, Ys)) → U61(X, Xs, Y, Ys, le_in(X, Y))
The remaining pairs can at least be oriented weakly.

U61(X, Xs, Y, Ys, le_out) → MERGE_IN(Xs, .(Y, Ys))
U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))
Used ordering: Polynomial interpretation [25]:

POL(.(x1, x2)) = 1 + x2   
POL(0) = 0   
POL(MERGE_IN(x1, x2)) = x1   
POL(U10(x1)) = x1   
POL(U11(x1)) = 0   
POL(U61(x1, x2, x3, x4, x5)) = x2   
POL(U81(x1, x2, x3, x4, x5)) = 1 + x2   
POL(gt_in(x1, x2)) = x1   
POL(gt_out) = 0   
POL(le_in(x1, x2)) = 0   
POL(le_out) = 0   
POL(s(x1)) = 1 + x1   

The following usable rules [17] were oriented: none



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U61(X, Xs, Y, Ys, le_out) → MERGE_IN(Xs, .(Y, Ys))
U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U10(gt_out) → gt_out
U11(le_out) → le_out

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
U10(x0)
U11(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
                          ↳ QDP
                            ↳ DependencyGraphProof
QDP
                                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U10(gt_out) → gt_out
U11(le_out) → le_out

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
U10(x0)
U11(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
                          ↳ QDP
                            ↳ DependencyGraphProof
                              ↳ QDP
                                ↳ UsableRulesProof
QDP
                                    ↳ QReductionProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
U10(x0)
U11(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

le_in(x0, x1)
U11(x0)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
                          ↳ QDP
                            ↳ DependencyGraphProof
                              ↳ QDP
                                ↳ UsableRulesProof
                                  ↳ QDP
                                    ↳ QReductionProof
QDP
                                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U81(X, Xs, Y, Ys, gt_out) → MERGE_IN(.(X, Xs), Ys)
MERGE_IN(.(X, Xs), .(Y, Ys)) → U81(X, Xs, Y, Ys, gt_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out

The set Q consists of the following terms:

gt_in(x0, x1)
U10(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

SPLIT_IN(.(X, Xs)) → SPLIT_IN(Xs)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ PiDPToQDPProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U10(x1, x2, x3)  =  U10(x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x3, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U11(x1, x2, x3)  =  U11(x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
QDP
                    ↳ Rewriting
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U21(X2s, mergesort_out(Y1s)) → MERGESORT_IN(X2s)
U11(split_out(X1s, X2s)) → MERGESORT_IN(X1s)
MERGESORT_IN(.(X, .(Y, Xs))) → U11(split_in(.(X, .(Y, Xs))))
U11(split_out(X1s, X2s)) → U21(X2s, mergesort_in(X1s))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs))) → U1(split_in(.(X, .(Y, Xs))))
split_in(.(X, Xs)) → U5(X, split_in(Xs))
split_in([]) → split_out([], [])
U5(X, split_out(Zs, Ys)) → split_out(.(X, Ys), Zs)
U1(split_out(X1s, X2s)) → U2(X2s, mergesort_in(X1s))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(X2s, mergesort_out(Y1s)) → U3(Y1s, mergesort_in(X2s))
U3(Y1s, mergesort_out(Y2s)) → U4(merge_in(Y1s, Y2s))
merge_in(.(X, Xs), .(Y, Ys)) → U8(X, Xs, Y, Ys, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out
U8(X, Xs, Y, Ys, gt_out) → U9(Y, merge_in(.(X, Xs), Ys))
merge_in(.(X, Xs), .(Y, Ys)) → U6(X, Xs, Y, Ys, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U11(le_out) → le_out
U6(X, Xs, Y, Ys, le_out) → U7(X, merge_in(Xs, .(Y, Ys)))
merge_in(Xs, []) → merge_out(Xs)
merge_in([], Xs) → merge_out(Xs)
U7(X, merge_out(Zs)) → merge_out(.(X, Zs))
U9(Y, merge_out(Zs)) → merge_out(.(Y, Zs))
U4(merge_out(Ys)) → mergesort_out(Ys)

The set Q consists of the following terms:

mergesort_in(x0)
split_in(x0)
U5(x0, x1)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U10(x0)
U8(x0, x1, x2, x3, x4)
le_in(x0, x1)
U11(x0)
U6(x0, x1, x2, x3, x4)
U7(x0, x1)
U9(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
By rewriting [15] the rule MERGESORT_IN(.(X, .(Y, Xs))) → U11(split_in(.(X, .(Y, Xs)))) at position [0] we obtained the following new rules:

MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, split_in(.(Y, Xs))))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
QDP
                        ↳ Rewriting
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U11(split_out(X1s, X2s)) → MERGESORT_IN(X1s)
U21(X2s, mergesort_out(Y1s)) → MERGESORT_IN(X2s)
U11(split_out(X1s, X2s)) → U21(X2s, mergesort_in(X1s))
MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, split_in(.(Y, Xs))))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs))) → U1(split_in(.(X, .(Y, Xs))))
split_in(.(X, Xs)) → U5(X, split_in(Xs))
split_in([]) → split_out([], [])
U5(X, split_out(Zs, Ys)) → split_out(.(X, Ys), Zs)
U1(split_out(X1s, X2s)) → U2(X2s, mergesort_in(X1s))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(X2s, mergesort_out(Y1s)) → U3(Y1s, mergesort_in(X2s))
U3(Y1s, mergesort_out(Y2s)) → U4(merge_in(Y1s, Y2s))
merge_in(.(X, Xs), .(Y, Ys)) → U8(X, Xs, Y, Ys, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out
U8(X, Xs, Y, Ys, gt_out) → U9(Y, merge_in(.(X, Xs), Ys))
merge_in(.(X, Xs), .(Y, Ys)) → U6(X, Xs, Y, Ys, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U11(le_out) → le_out
U6(X, Xs, Y, Ys, le_out) → U7(X, merge_in(Xs, .(Y, Ys)))
merge_in(Xs, []) → merge_out(Xs)
merge_in([], Xs) → merge_out(Xs)
U7(X, merge_out(Zs)) → merge_out(.(X, Zs))
U9(Y, merge_out(Zs)) → merge_out(.(Y, Zs))
U4(merge_out(Ys)) → mergesort_out(Ys)

The set Q consists of the following terms:

mergesort_in(x0)
split_in(x0)
U5(x0, x1)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U10(x0)
U8(x0, x1, x2, x3, x4)
le_in(x0, x1)
U11(x0)
U6(x0, x1, x2, x3, x4)
U7(x0, x1)
U9(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
By rewriting [15] the rule MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, split_in(.(Y, Xs)))) at position [0,1] we obtained the following new rules:

MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, U5(Y, split_in(Xs))))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
                      ↳ QDP
                        ↳ Rewriting
QDP
                            ↳ QDPOrderProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U21(X2s, mergesort_out(Y1s)) → MERGESORT_IN(X2s)
U11(split_out(X1s, X2s)) → MERGESORT_IN(X1s)
U11(split_out(X1s, X2s)) → U21(X2s, mergesort_in(X1s))
MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, U5(Y, split_in(Xs))))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs))) → U1(split_in(.(X, .(Y, Xs))))
split_in(.(X, Xs)) → U5(X, split_in(Xs))
split_in([]) → split_out([], [])
U5(X, split_out(Zs, Ys)) → split_out(.(X, Ys), Zs)
U1(split_out(X1s, X2s)) → U2(X2s, mergesort_in(X1s))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(X2s, mergesort_out(Y1s)) → U3(Y1s, mergesort_in(X2s))
U3(Y1s, mergesort_out(Y2s)) → U4(merge_in(Y1s, Y2s))
merge_in(.(X, Xs), .(Y, Ys)) → U8(X, Xs, Y, Ys, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out
U8(X, Xs, Y, Ys, gt_out) → U9(Y, merge_in(.(X, Xs), Ys))
merge_in(.(X, Xs), .(Y, Ys)) → U6(X, Xs, Y, Ys, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U11(le_out) → le_out
U6(X, Xs, Y, Ys, le_out) → U7(X, merge_in(Xs, .(Y, Ys)))
merge_in(Xs, []) → merge_out(Xs)
merge_in([], Xs) → merge_out(Xs)
U7(X, merge_out(Zs)) → merge_out(.(X, Zs))
U9(Y, merge_out(Zs)) → merge_out(.(Y, Zs))
U4(merge_out(Ys)) → mergesort_out(Ys)

The set Q consists of the following terms:

mergesort_in(x0)
split_in(x0)
U5(x0, x1)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U10(x0)
U8(x0, x1, x2, x3, x4)
le_in(x0, x1)
U11(x0)
U6(x0, x1, x2, x3, x4)
U7(x0, x1)
U9(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MERGESORT_IN(.(X, .(Y, Xs))) → U11(U5(X, U5(Y, split_in(Xs))))
The remaining pairs can at least be oriented weakly.

U21(X2s, mergesort_out(Y1s)) → MERGESORT_IN(X2s)
U11(split_out(X1s, X2s)) → MERGESORT_IN(X1s)
U11(split_out(X1s, X2s)) → U21(X2s, mergesort_in(X1s))
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( [] ) =
/0\
\0/

M( 0 ) =
/0\
\0/

M( U3(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( le_in(x1, x2) ) =
/1\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( U5(x1, x2) ) =
/0\
\1/
+
/00\
\00/
·x1+
/11\
\10/
·x2

M( mergesort_in(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( U10(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( mergesort_out(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( s(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( U11(x1) ) =
/1\
\0/
+
/00\
\00/
·x1

M( gt_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( le_out ) =
/0\
\0/

M( split_in(x1) ) =
/0\
\1/
+
/11\
\01/
·x1

M( U1(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( U2(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( .(x1, x2) ) =
/1\
\0/
+
/00\
\00/
·x1+
/11\
\11/
·x2

M( split_out(x1, x2) ) =
/0\
\1/
+
/11\
\00/
·x1+
/11\
\11/
·x2

M( U6(x1, ..., x5) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2+
/00\
\00/
·x3+
/00\
\00/
·x4+
/00\
\00/
·x5

M( gt_out ) =
/0\
\0/

M( merge_out(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( merge_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( U7(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( U4(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( U9(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( U8(x1, ..., x5) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2+
/00\
\00/
·x3+
/00\
\00/
·x4+
/00\
\00/
·x5

Tuple symbols:
M( U11(x1) ) = 1+
[1,0]
·x1

M( MERGESORT_IN(x1) ) = 1+
[1,1]
·x1

M( U21(x1, x2) ) = 1+
[1,1]
·x1+
[0,0]
·x2


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

le_in(0, 0) → le_out
U11(le_out) → le_out
U5(X, split_out(Zs, Ys)) → split_out(.(X, Ys), Zs)
le_in(s(X), s(Y)) → U11(le_in(X, Y))
split_in([]) → split_out([], [])
split_in(.(X, Xs)) → U5(X, split_in(Xs))
le_in(0, s(Y)) → le_out



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ Rewriting
                      ↳ QDP
                        ↳ Rewriting
                          ↳ QDP
                            ↳ QDPOrderProof
QDP
                                ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U11(split_out(X1s, X2s)) → MERGESORT_IN(X1s)
U21(X2s, mergesort_out(Y1s)) → MERGESORT_IN(X2s)
U11(split_out(X1s, X2s)) → U21(X2s, mergesort_in(X1s))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs))) → U1(split_in(.(X, .(Y, Xs))))
split_in(.(X, Xs)) → U5(X, split_in(Xs))
split_in([]) → split_out([], [])
U5(X, split_out(Zs, Ys)) → split_out(.(X, Ys), Zs)
U1(split_out(X1s, X2s)) → U2(X2s, mergesort_in(X1s))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(X2s, mergesort_out(Y1s)) → U3(Y1s, mergesort_in(X2s))
U3(Y1s, mergesort_out(Y2s)) → U4(merge_in(Y1s, Y2s))
merge_in(.(X, Xs), .(Y, Ys)) → U8(X, Xs, Y, Ys, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U10(gt_in(X, Y))
U10(gt_out) → gt_out
U8(X, Xs, Y, Ys, gt_out) → U9(Y, merge_in(.(X, Xs), Ys))
merge_in(.(X, Xs), .(Y, Ys)) → U6(X, Xs, Y, Ys, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U11(le_in(X, Y))
U11(le_out) → le_out
U6(X, Xs, Y, Ys, le_out) → U7(X, merge_in(Xs, .(Y, Ys)))
merge_in(Xs, []) → merge_out(Xs)
merge_in([], Xs) → merge_out(Xs)
U7(X, merge_out(Zs)) → merge_out(.(X, Zs))
U9(Y, merge_out(Zs)) → merge_out(.(Y, Zs))
U4(merge_out(Ys)) → mergesort_out(Ys)

The set Q consists of the following terms:

mergesort_in(x0)
split_in(x0)
U5(x0, x1)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U10(x0)
U8(x0, x1, x2, x3, x4)
le_in(x0, x1)
U11(x0)
U6(x0, x1, x2, x3, x4)
U7(x0, x1)
U9(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 3 less nodes.
We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
MERGESORT_IN(.(X, .(Y, Xs)), Ys) → SPLIT_IN(.(X, .(Y, Xs)), X1s, X2s)
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → U51(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U31(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U41(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → MERGE_IN(Y1s, Y2s, Ys)
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U101(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U91(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U111(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U71(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U111(x1, x2, x3)  =  U111(x1, x2, x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x1, x2, x3, x5, x6)
U71(x1, x2, x3, x4, x5, x6)  =  U71(x1, x2, x3, x4, x6)
U51(x1, x2, x3, x4, x5)  =  U51(x1, x2, x5)
U101(x1, x2, x3)  =  U101(x1, x2, x3)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x2, x3, x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
MERGESORT_IN(.(X, .(Y, Xs)), Ys) → SPLIT_IN(.(X, .(Y, Xs)), X1s, X2s)
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → U51(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U31(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U41(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
U31(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → MERGE_IN(Y1s, Y2s, Ys)
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U101(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U91(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U111(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U71(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U111(x1, x2, x3)  =  U111(x1, x2, x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x1, x2, x3, x5, x6)
U71(x1, x2, x3, x4, x5, x6)  =  U71(x1, x2, x3, x4, x6)
U51(x1, x2, x3, x4, x5)  =  U51(x1, x2, x5)
U101(x1, x2, x3)  =  U101(x1, x2, x3)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x2, x3, x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 5 SCCs with 11 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
LE_IN(x1, x2)  =  LE_IN(x1, x2)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
GT_IN(x1, x2)  =  GT_IN(x1, x2)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U81(X, Xs, Y, Ys, Zs, gt_in(X, Y))
U61(X, Xs, Y, Ys, Zs, le_out(X, Y)) → MERGE_IN(Xs, .(Y, Ys), Zs)
MERGE_IN(.(X, Xs), .(Y, Ys), .(X, Zs)) → U61(X, Xs, Y, Ys, Zs, le_in(X, Y))
U81(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → MERGE_IN(.(X, Xs), Ys, Zs)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x4, x6)
U61(x1, x2, x3, x4, x5, x6)  =  U61(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SPLIT_IN(.(X, Xs), .(X, Ys), Zs) → SPLIT_IN(Xs, Zs, Ys)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, Xs)), Ys) → U11(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → MERGESORT_IN(X1s, Y1s)
U21(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → MERGESORT_IN(X2s, Y2s)
U11(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U21(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, Xs)), Ys) → U1(X, Y, Xs, Ys, split_in(.(X, .(Y, Xs)), X1s, X2s))
split_in(.(X, Xs), .(X, Ys), Zs) → U5(X, Xs, Ys, Zs, split_in(Xs, Zs, Ys))
split_in([], [], []) → split_out([], [], [])
U5(X, Xs, Ys, Zs, split_out(Xs, Zs, Ys)) → split_out(.(X, Xs), .(X, Ys), Zs)
U1(X, Y, Xs, Ys, split_out(.(X, .(Y, Xs)), X1s, X2s)) → U2(X, Y, Xs, Ys, X2s, mergesort_in(X1s, Y1s))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, Xs, Ys, X2s, mergesort_out(X1s, Y1s)) → U3(X, Y, Xs, Ys, Y1s, mergesort_in(X2s, Y2s))
U3(X, Y, Xs, Ys, Y1s, mergesort_out(X2s, Y2s)) → U4(X, Y, Xs, Ys, merge_in(Y1s, Y2s, Ys))
merge_in(.(X, Xs), .(Y, Ys), .(Y, Zs)) → U8(X, Xs, Y, Ys, Zs, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U10(X, Y, gt_in(X, Y))
U10(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Xs, Y, Ys, Zs, gt_out(X, Y)) → U9(X, Xs, Y, Ys, Zs, merge_in(.(X, Xs), Ys, Zs))
merge_in(.(X, Xs), .(Y, Ys), .(X, Zs)) → U6(X, Xs, Y, Ys, Zs, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U11(X, Y, le_in(X, Y))
U11(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U6(X, Xs, Y, Ys, Zs, le_out(X, Y)) → U7(X, Xs, Y, Ys, Zs, merge_in(Xs, .(Y, Ys), Zs))
merge_in(Xs, [], Xs) → merge_out(Xs, [], Xs)
merge_in([], Xs, Xs) → merge_out([], Xs, Xs)
U7(X, Xs, Y, Ys, Zs, merge_out(Xs, .(Y, Ys), Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(X, Zs))
U9(X, Xs, Y, Ys, Zs, merge_out(.(X, Xs), Ys, Zs)) → merge_out(.(X, Xs), .(Y, Ys), .(Y, Zs))
U4(X, Y, Xs, Ys, merge_out(Y1s, Y2s, Ys)) → mergesort_out(.(X, .(Y, Xs)), Ys)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split_in(x1, x2, x3)  =  split_in(x1)
U5(x1, x2, x3, x4, x5)  =  U5(x1, x2, x5)
[]  =  []
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U10(x1, x2, x3)  =  U10(x1, x2, x3)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
U6(x1, x2, x3, x4, x5, x6)  =  U6(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U11(x1, x2, x3)  =  U11(x1, x2, x3)
U7(x1, x2, x3, x4, x5, x6)  =  U7(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains